package com.zcn.io.web.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zcn.io.common.entity.OrderMain;
import com.zcn.io.common.pojo.CommonResult;
import com.zcn.io.web.api.entity.PageNoteConfig;
import com.zcn.io.web.api.query.OrderMainQuery;
import com.zcn.io.web.service.PageNoteService;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * @desc: 页面笔记
 * @author: 202438 邱建伟
 * @date: 2025/6/2 14:59
 */
@RestController
@AllArgsConstructor
@RequestMapping("/pageNote")
public class PageNoteController {

    private final PageNoteService pageNoteService;

    @GetMapping("/list")
    public CommonResult<Page<PageNoteConfig>> list(Page<PageNoteConfig> page, PageNoteConfig query) {
        pageNoteService.list(page, query);
        return CommonResult.success(page);
    }

    //根据id获取
    @GetMapping("/getById")
    public CommonResult<PageNoteConfig> getById(PageNoteConfig pageNoteConfig) {
        return CommonResult.success(pageNoteService.getById(pageNoteConfig));
    }

    //新增
    @PostMapping("/save")
    public CommonResult<PageNoteConfig> save(@RequestBody PageNoteConfig pageNoteConfig) {
        pageNoteService.save(pageNoteConfig);
        return CommonResult.success(pageNoteConfig);
    }

    //修改
    @PostMapping("/updateById")
    public CommonResult<PageNoteConfig> updateById(@RequestBody PageNoteConfig pageNoteConfig) {
        pageNoteService.updateById(pageNoteConfig);
        return CommonResult.success(pageNoteConfig);
    }

    //删除
    @DeleteMapping("/deleteById")
    public CommonResult<PageNoteConfig> deleteById(PageNoteConfig pageNoteConfig) {
        pageNoteService.deleteById(pageNoteConfig);
        return CommonResult.success(pageNoteConfig);
    }


}
